<div class="row">
    <form role="form" action="/order/addNew" class="form-horizontal" method="post" id="helpOrderForm">
	<div class="col-md-2">
		<textarea style="width: 100%;height: 285px;" name="leaveMsg" placeholder="订单留言"></textarea>
		<input type="hidden" name="isReplace" value="1" />
		<input type="hidden" name="payway" value="PAY_ONLINE" />
		<input type="hidden" name="settleWay" value="CREDIT" />
		<input type="hidden" name="orderState" value="WAIT_BUYER_PAY" />
	</div>
	<div class="col-md-10">
        <div class="portlet-body form">
                <div class="form-body">
                    <div class="row">
                        <div class="form-group">
                            <label class="control-label col-md-2">*客户名称：</label>
                            <div class="col-md-2">
                                <select name="memberId"  class="form-control customer-select" required>
                                	<option value="">--请选择--</option>
                                    #foreach($company in $!companys)
                                    <option value="$!company.id">$!company.name</option>
                                    #end
                                </select>
                            </div>

                            <label class="control-label col-md-2">*收货地址：</label>
                            <div class="col-md-2">
                                <select name="shippingInfoId"  class=" form-control shippingInfoId" id="shippingInfoId" required>
                                  <option value="">--请选择--</option>
                                </select>
                            </div>

                            <label class="control-label col-md-2">*期望收货日期：</label>
                            <div class="col-md-2">
                                <input type="text" class="form-control common-date-datepicker" name="RequirementDate" id="timeID"  readOnly required style="width: 145px;display: inline;"/><span></span>
                            
                                <i class="fa fa-calendar" style="display: inline;"></i>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="dataTables_wrapper no-footer">
                            <div>
                                <table class="table table-striped table-bordered table-hover" style="table-layout:fixed">
                                    <thead>
                                    <tr>
	                                    <th>货品编码</th>
										<th class="col-md-2">货品名称</th>
										<th>规格</th>
										<th>单价</th>
										<th>起订量</th>
										<th  class="col-md-2">基本数量</th>
										<th  class="col-md-2">交易数量</th>
										<th>金额</th>
										<th>优惠</th>
										<th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
									#foreach($sku in $cartSkus)
									#set($quantity=$cartMap.get($sku.id))
									#set($product=$!sku.product)
									#set($_thisPrice =$!product.startNum*$!sku.skuPrice )
										<tr>
											<td>$!sku.code</td>
											<td class="ellipsis_td">$!product.name</td>
											<td>$!sku.attrValueNames</td>
											<td class="skuPrice">$!sku.skuPrice</td>
											<td>$!product.startNum</td>
											<td noWrap>
												<input type="text" name="quantity" class="input-xsmall_80 positiveIntegerNum2 willQuantity" min="$!product.startNum" value="$quantity"/>
												<div class="input-xsmall_80_right">$!product.unit.name</div>
												<input type="hidden" value="$sku.id"  name="skuId"/>
											</td>
											<td noWrap>
												#set($translateRate = 1) 
												#if($sku.translateRate) 
													#set($translateRate = $sku.translateRate) 
												#end
												#set($startUxNum=$!product.startNum/$translateRate)
												#set($startUxValue=$quantity/$translateRate)
												#if($!product.startNum%$translateRate >0)
													#set($startUxNum=$startUxNum+1)
													#set($startUxValue=$startUxValue+1)
												#end
												<input type="text" name="axQuantity" class="input-xsmall_80 positiveIntegerNum2 willAxQuantity" value="$!startUxValue" transRate="$translateRate" min="$startUxNum"/>
												<div class="input-xsmall_80_right">$!sku.auxUnit.name</div>
											</td>
											<td class="trAmount">$_thisPrice</td>
											<td>0.00</td>
											<td>
												<a class="btn green btn-outline btn-sm del-session-sku" thref="/order/delSkuCart?skuId=$!sku.id" href="javascript:">
													<i class="fa fa-trash"></i>
													删除
												</a>
											</td>
										</tr>
									#end
                                    </tbody>
                                </table>
                                <div class="form-actions right">
									<a href="javascript:;" thref="/quotation/list" onclick="$('#helpOrderForm').attr('action','/order/addQuotation') ;" class="btn green ajax-post"> <i class="fa fa-check"></i>价格申请</a>
									<a href="javascript:;" thref="/order/list" onclick="$('#helpOrderForm').attr('action','/order/addNew') ;" class="btn green ajax-post"> <i class="fa fa-check"></i>提交订单</a> 
								</div>
                            </div>
                        </div>
                    </div>
                </div>
        </div>
	</div>
	</form>
</div>
<script src="/assets/scripts/views-date.js" type="text/javascript"></script>
<script src="/assets/scripts/views-orderadd.js" type="text/javascript"></script>
<script  type="text/javascript" >
    $("#timeID").change(function(){
    	flag=true;
    	$(this).next("span").empty();
    	var  getDate=$("#timeID").val();
    	var oldDate=new Date(getDate).getTime();
    	var nowTime=new Date().getTime();
        
    	if(oldDate<=nowTime){
    	   $(this).next("span").html("<font color='red'>期望收货日期要大于现在时间</font>")
    	  flag=false;
    	}
    	
    });
   
  /*   $(".ajax-post").click(function(){
  
    	if(!flag){
    		//if($(this).next("span")==null||$(this).next("span")==""){
    		   $("#helpOrderForm").submit(function() {
    	    	  return false;
    	    	 } );
    		//}
    	}
    	
    });   */
</script>
